#include <string>
#include <vector>

using namespace std;

class Solution {
public:
    char firstUniqChar(string s) {
        vector<int> nums(128);
        vector<char> order;
        order.reserve(128);
        for (int i = 0; i < s.size(); i++) {
            if (nums[s[i]] == 0) {
                order.emplace_back(s[i]);
            }
            nums[s[i]]++;
        }
        for (char& c : order) {
            if (nums[c] == 1) {
                return c;
            }
        }
        return ' ';
    }
};